﻿@model S4Store.Models.TelSaleReport.IndexModel
@{
    ViewBag.Title = "Index";
    Layout = null;

    S4Store.Models.Chart.Column ChartModel = new S4Store.Models.Chart.Column();
    ChartModel.Name = "各车型电话销售概况";
    ChartModel.YAxis = "比率(%)";
    foreach (var m in Model.Reports)
    {
        ChartModel.XAxis.Add(m.CarBrand.Name);
    }
    S4Store.Models.Chart.ChartSeries series1 = new S4Store.Models.Chart.ChartSeries();
    series1.Name = "时间进度";
    foreach (var m in Model.Reports)
    {
        series1.Data.Add(m.RateOfTime);
    }
    ChartModel.Serieses.Add(series1);

    S4Store.Models.Chart.ChartSeries series2 = new S4Store.Models.Chart.ChartSeries();
    series2.Name = "销售进度";
    foreach (var m in Model.Reports)
    {
        series2.Data.Add(m.XSJD);
    }
    ChartModel.Serieses.Add(series2);
    ChartModel.Colors = new List<string> { S4Store.Models.Chart.Color.Green, S4Store.Models.Chart.Color.Blue };
    
    
}
<script type="text/javascript">
    $(function () {
        var $c = $("#myContentArea");
        var count = $("#myContentArea").find("table td").has(".value").size();
        var right = parseInt($("#right").css("width").replace("px", "")) - 20;
        if (count * 190 + 70 >= right) {
            $c.width(count * 190 + 70);
        }
    });
</script>
<div style="height: 100%; width: 100%; overflow: auto;">
<div id="myContentArea" style="overflow:hidden">
@Html.Action("ReportBar", "Common", Model.BarModel)
<div style="position:relative; width:100%">      
        @Html.Partial("../Chart/Column", ChartModel)    
</div>
<div>
        <div style=" margin-left:70px; overflow:hidden">
        <table style="width:100%">
            <tr>
            @foreach (var m in Model.Reports)
            {   
                <td align="center">
                    @if (m.XSSJJDC < 0)
                    {
                        <a class="specialRed"  href="@Url.Action("CarBrandDetail", new { Month = Model.BarModel.Month.ToString("yyyy-MM-dd"), SearchCarBrandId = m.CarBrand.Id })" target="navtab" title="@(m.CarBrand.Name)销量时间进度差">
                            <div class="value">@m.XSSJJDC.toInt()%</div>
                            <div class="rt">实时销量：@m.JCS</div>
                            <div class="rb">应时销量：@m.YSXL.toInt(0)</div>
                        </a>
                    }
                    else
                    {
                        <a class="specialGreen"   href="@Url.Action("CarBrandDetail", new { Month = Model.BarModel.Month.ToString("yyyy-MM-dd"), SearchCarBrandId = m.CarBrand.Id })" target="navtab" title="@(m.CarBrand.Name)销量时间进度差">
                            <div class="value">@m.XSSJJDC.toInt()%</div>
                            <div class="rt">实时销量：@m.JCS</div>
                            <div class="rb">应时销量：@m.YSXL.toInt(0)</div>
                        </a>
                    }
                </td>
            }
            </tr>
        </table>
        </div>
        </div>
        </div>
</div>
